package com.spring.mongo;

import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;

import com.mongodb.Mongo;
import com.spring.mongo.model.User;

public class MyApp {

	public static void main(String[] args) throws Exception {

//		MongoOperations mongoOps = new MongoTemplate(new MongoClient(), "mytest");
//		mongoOps.insert(new User("王晓晖", "15801497121"));
//		mongoOps.dropCollection("person");
		
		
		MongoOperations mongoOps = new MongoTemplate(new SimpleMongoDbFactory(new Mongo(), "mytest"));
		mongoOps.insert(new User("王晓晖", "15801497121"));
		mongoOps.dropCollection("person");
	}

}
